Ext.define('ExtMVC.view.portal.PortletPanel', {
    extend: 'ExtMVC.view.app.PortalPanel', 
    //extend: 'Ext.panel.Panel',    
    
    alias: 'widget.portletpanel',

    //uses: ['ExtMVC.util.Constants'],
	requires:['app.view.portlet.HTMLPanel', 'app.view.portlet.JSONPanel'], 
	
	//layout: 'column',

    getTools: function(){
        return [{
            xtype: 'tool',
            type: 'gear',
            handler: function(e, target, panelHeader, tool){
                var portlet = panelHeader.ownerCt;
                portlet.setLoading('Loading...');
                Ext.defer(function() {
                    portlet.setLoading(false);
                }, 2000);
            }
        }];
    },
    
    initComponent: function() {
        
        Ext.apply(this, {
		
			items: [{
				title	: 'HTML Panel',
				height	: 400,
				url		: 'nope.php',
				draggable : true,
				xtype	: 'HTMLPanel'
			},{
				title	: 'JSON Panel',
				height	: 400,
				url		: 'json.php',
				xtype	: 'JSONPanel',
				draggable: true
			}]

            /*items: [{
                id: 'col-1',
                items: [/*{
                    id: 'portlet-1',
                    title: 'Grid Portlet',
                    tools: this.getTools(),
                    items: Ext.create('ExtMVC.view.portlet.GridPortlet')
                },*//*{
                    id: 'portlet-2',
                    title: 'Widget 1',
					height: 400,
					columnWidth: 0.5,
                    //tools: this.getTools(),
                    html: 'Esto es un codigo html'
                }]
            },{
                id: 'col-2',
                items: [{
                    id: 'portlet-3',
                    title: 'Widget 2',
					height: 400,
					columnWidth: 0.5,
                    //tools: this.getTools(),
                    html: 'Esto es un codigo html'
                }]
            }/*,{
                id: 'col-3',
                items: [{
                    id: 'portlet-4',
                    title: 'Stock Portlet',
                    tools: this.getTools(),
                    items: Ext.create('ExtMVC.view.portlet.ChartPortlet')
                }]
            }*///]
            
        });
                
        this.callParent(arguments);
		//this.items.items[0].loadHTML();
    }
});
